<?php

//---------------------------------------------------------------------------------------------------------------------------------------						
				//Converting Date															
						function DateConvertFromMySql($old_date, $layout) 									
						{ 															
				//Remove non-numeric characters that might exist (e.g. hyphens and colons) 							
							$old_date = ereg_replace('[^0-9]', '', $old_date); 								
				//Extract the different elements that make up the date and time 									
							$_year = substr($old_date,0,4); 										
							$_month = substr($old_date,4,2); 										
							$_day = substr($old_date,6,2); 										
							$_hour = substr($old_date,8,2); 										
							$_minute = substr($old_date,10,2); 										
							$_second = substr($old_date,12,2); 										
				//Combine the date function with mktime to produce a user-friendly date & time 
							//$new_date = $_day."-".$_month."-".$_year;		
							//$new_date = date($layout,$data);				
							$new_date = date($layout, mktime(0,0,0,$_month, $_day, $_year)); 	
							return $new_date; 												
						} 			

//----------------------------------------------------------------------------------------------------------------------------------------
				//Converting Date															
						function DateConvertToMySql($old_date, $layout) 									
						{ 															
				//Remove non-numeric characters that might exist (e.g. hyphens and colons) 							
							//$old_date = ereg_replace('[^0-9]', '', $old_date); 								
				//Extract the different elements that make up the date and time 									
							$_day = substr($old_date,0,2); 	
							//echo $_day;
							$_month = substr($old_date,3,2); 		
							//echo $_month;								
							$_year = substr($old_date,6,4);
							//echo $_year;
				//Combine the date function with mktime to produce a user-friendly date & time 							
							$new_date =$_year."-".$_month."-".$_day; 									
							return $new_date; 												
						} 			
?>